package com.ruoyi.mf178.domain;

import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Data
public class Mf178TradeResponse {
    public Integer code;
    public String msg;
    public List<Mf178TradeResponseData> data;

    @Data
    public static class Mf178TradeResponseData {
        public String orderNo;
        public String cardNo;
        public String cardPwd;
        public String cardType;
        public BigDecimal costPrice;
    }


    public static Mf178TradeResponse success(String orderNo, String cardNo, String cardPwd, String cardType, BigDecimal costPrice) {
        Mf178TradeResponse response = new Mf178TradeResponse();
        response.setCode(200);
        response.setMsg("成功");
        Mf178TradeResponseData data1 = new Mf178TradeResponseData();
        data1.setOrderNo(orderNo);
        data1.setCardNo(cardNo);
        data1.setCardPwd(cardPwd);
        data1.setCardType(cardType);
        data1.setCostPrice(costPrice);
        List<Mf178TradeResponseData> list = new ArrayList<>();
        list.add(data1);
        response.setData(list);
        return response;
    }

    public static Mf178TradeResponse success(List<Mf178TradeResponseData> data) {
        Mf178TradeResponse response = new Mf178TradeResponse();
        response.setCode(200);
        response.setMsg("成功");
        response.setData(data);
        return response;
    }

    public static Mf178TradeResponse error(Integer code, String msg) {
        Mf178TradeResponse response = new Mf178TradeResponse();
        response.setCode(code);
        response.setMsg(msg);
        return response;
    }


    public Boolean isSuccess() {
        return this.code.equals(200);
    }
}
